



//% color="#0082fc" iconWidth=50 iconHeight=40
namespace miniewaLIS2DH12{
	
	//初始化LIS2DH12
	//% block="LIS2DH12 initialization  " blockType="command"
	
	export function initialization(parameter: any, block: any) {
        
		Generator.addInclude(`LIS2DH12include`,`#include <LIS2DH12.h>`,true);
		Generator.addObject(`lis`,`LIS2DH12`,`lis`,true);
		Generator.addSetup(`lisbegin`,`lis.begin(LIS2DH12_RANGE_8GA);`,true);
		}

	//读取三轴加速度
	//% block="DuQu [zhou] mg" blockType="reporter"
	//%zhou.shadow="dropdown" zhou.options="zhouss" zhou.defl="zhouss.x"

	export function read(parameter: any, block: any) {
        let zhouk = parameter.zhou.code;
		if(zhouk === "x"){
			Generator.addCode(`(lis.getX())`);}
		else if (zhouk === "y"){
			Generator.addCode(`(lis.getY())`);
		}else if(zhouk === "z"){
			Generator.addCode(`(lis.getZ())`);
		}
		
		
		}

	
	
	
	
   
	
	
	
	
	
}
